package edu.ivanov.apm.ui;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
 * User: Илья
 * Date: 08.10.13
 * Time: 20:18
 */
public class UI extends Application {

	private static final String TITLE = "Фрактал \"Куст\"";

    private static DrawBoard rootPane;

	private static final int WIDTH = 600;
	private static final int HEIGHT = 500;

	public void start(Stage primaryStage) {
		if (rootPane == null)
            throw new RuntimeException("Не задана главная панель для отображения формы");

        Scene scene = new Scene(rootPane);
		primaryStage.setScene(scene);
		primaryStage.setTitle(TITLE);
		primaryStage.show();

        rootPane.draw();

        rootPane = null;
	}

	public static final void show(DrawBoard rootPane) {
        if (rootPane == null)
            return;

        UI.rootPane = rootPane;

		launch(UI.class, (String[]) null);
	}
}
